#ifndef ABSUI_PROJECT_VIEW_HPP
#define ABSUI_PROJECT_VIEW_HPP

#include "AbsUI/AbsUIConfig.hpp"
#include <boost/signals/trackable.hpp>

namespace Model { class Project; }
namespace Ctrl { class ProjectController; }

namespace AbsUI
{

/// @ingroup AbsUI
/// @brief It provides the interface that needs to be implemented by a project view. It also makes the basic 
///		initialization a project view should do (e.g. registering to controller's signals).
/// 
/// While intializing, the view connects private slot methods to the signals published by the project controller. These 
///	methods are calling some pure virtual methods that subclasses need to implement. This additional level of 
///	indirection is needed because the virtual methods can't be bound inside the constructor to the signals and still 
///	keep the polymorphism.
class ABSUI_API ProjectView: boost::signals::trackable
{
public:
	/// @brief It connects the slot methods to the signals provided by the specified controller.
	/// @param ctrler the controller that this view should connect to.
	ProjectView( Ctrl::ProjectController& ctrler);


	/// @brief Dummy destructor.
	virtual ~ProjectView();

	/// @brief It should implement the update of the view after the displayed project has been changed.
	virtual void changeProject( Model::Project* pNewProject) = 0;

	/// @brief It should implement the update of the view after the project description has been changed.
	virtual void changeProjectDescription( const Model::Project& changedProject) = 0;

private:
	/// @brief It is the slot connected to the project controller.
	/// 
	/// It calls the AbsUI::ProjectView::changeProject method which should handle the project changing signal.
	void projectChangeSlot( Model::Project* newProject);

	/// @brief It is the slot connected to the project controller.
	/// 
	/// It calls the AbsUI::ProjectView::changeProjectDescription method which should handle the project description 
	///	changing signal.
	void projectDescriptionChangedSlot( const Model::Project& changedProject);

protected:
	Ctrl::ProjectController& rCtrler_;

private:
	/// @brief Disabled assignment operator
	ProjectView& operator=( const ProjectView&);
};

} // namespace AbsUI

#endif // ABSUI_PROJECT_VIEW_HPP
